package com.wcn.sell.controller;

import com.wcn.sell.dto.OrderDTO;
import com.wcn.sell.enums.ResultEnum;
import com.wcn.sell.exception.SellException;
import com.wcn.sell.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: wangchaonan
 * @Date: 2018/9/20 17:44
 * @Version 1.0
 */
@Controller
public class PayController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/create")
    public void create(@RequestParam("orderId") String orderId, @RequestParam("returnUrl") String returnUrl) {

        //1.查询订单
        OrderDTO orderDTO = orderService.findOne(orderId);
        if (orderDTO == null) {
            throw new SellException(ResultEnum.ORDER_NOT_EXIT);
        }
        //2.发起支付
    }
}
